package com.heitian.ssm.controller;

import com.heitian.ssm.dao.StatusDao;
import com.heitian.ssm.model.JsonResponse;
import com.heitian.ssm.model.JsonResponsee;
import com.heitian.ssm.model.Status;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Zhangxq on 2016/7/15.
 */

@Controller
@RequestMapping("/status")
public class StatusController {

    private Logger log = Logger.getLogger(UserController.class);
    @Resource
    private StatusDao statusDao;

    @RequestMapping(method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public JsonResponsee selectStatus(HttpServletRequest request, Model model) {
        log.info("查询所有用户信息");
        Status status = statusDao.showStatus();
        return new JsonResponsee(status);
    }

    @RequestMapping(value = "/assess", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public JsonResponse showAssess(HttpServletRequest request, Model model) {
        log.info("查询所有用户信息");
        Status status = statusDao.showAssess();
        return new JsonResponse(JsonResponse.SUCCESS, status);
    }
}
